package com.ftqh.project.travel.notes.repository;

import com.ftqh.project.travel.notes.entity.NoteImage;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import javax.transaction.Transactional;

/**
 * Created by Administrator on 2017/5/11.
 */
@Transactional
public interface NoteImageRepository extends JpaRepository<NoteImage, Long>,JpaSpecificationExecutor<NoteImage>{
    @Modifying(clearAutomatically = true)
    @Query("update NoteImage n set n.noteId = :noteId where n.id = :id")
    void updateNoteId(@Param("id") Long id, @Param("noteId") Long noteId);
}
